package com.chalk.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.chalk.model.TicketType;
import com.chalk.dao.TicketTypeDao;
import com.chalk.service.TicketTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author glq
 * @since 2020-12-24
 */

@Service
public class TicketTypeServiceImpl extends ServiceImpl<TicketTypeDao, TicketType> implements TicketTypeService {

    @Override
    public int addTicketType(TicketType entity) {
        return baseMapper.insert(entity);
    }

    @Override
    public int updateTicketType(TicketType entity) {
        return baseMapper.updateById(entity);
    }


    @Override
    public int deleteTicketType(Integer id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public List<TicketType> getTicketTypeToList(Integer venueId) {
        EntityWrapper<TicketType> wrapper = new EntityWrapper<>();
        wrapper.eq("is_delete", 0);
        wrapper.eq("venue_id", venueId);

        return selectList(wrapper);
    }
}
